import 'package:flutter/material.dart';
import 'package:ball_lion/base/base_controller.dart';
import 'package:ball_lion/utils/utils.dart';
import 'package:umeng_apm_sdk/umeng_apm_sdk.dart';
import 'package:ball_lion/server/api/ai_api.dart';
import 'package:ball_lion/entity/ai/model_entity.dart';
import 'package:ball_lion/entity/other/resource_entity.dart';
import 'package:ball_lion/server/api/home_api.dart';

class AiLogic extends BaseController {
  List<ModelEntity>? data;
  List<ResourceEntity>? lbt;
  final ScrollController scrollController = ApmScrollController();

  @override
  void onReady() {
    getData();
    super.onReady();
  }

  Future getData() async {
    lbt = await HomeApi.getResources("app_ai");
    data = await AiApi.modelAll() ?? [];
    update();
  }

  doRefresh() {
    if (refreshController.headerState?.mode.isIdle == false) return;
    refreshController.callRefresh();
  }

  @override
  void getRefresh() {
    getData();
    super.getRefresh();
  }
}
